package jjn.acwing.java_basic;

import java.util.Scanner;

/**
 * @author Jjn
 * @since 2023/9/3 21:59
 */
public class Acwing744 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int i = scanner.nextInt();
            String s = scanner.next();
            double[][] m = new double[12][12];
            for (int j = 0; j < 12; j++) {
                for (int k = 0; k < 12; k++) {
                    m[j][k] = scanner.nextDouble();
                }
            }
            double total = 0;
            for (int j = 0; j < 12; j++) {
                total += m[j][i];
            }
            if ("S".equals(s)) {
                System.out.printf("%.1f", total);
            } else {
                System.out.printf("%.1f", total / 12);
            }
        }
    }
}
